#include<stdio.h>
void Hanot(int n,char a,char c,char b);
int main(void)
{
    int n;
    char a,c,b;
    scanf("%d %c %c %c",&n,&a,&c,&b);
    Hanot(n,a,c,b);
    
    return 0; 
 } 
 
 void Hanot(int n,char a,char c,char b)
 {
    if(n==1)
           printf("1: %c -> %c\n",a,c);
    else{
        Hanot(n-1,a,b,c);
        printf("%d: %c -> %c\n",n,a,c);
        Hanot(n-1,b,c,a);
     }
 }
